<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\ApiService;

/**
 * Class LanJieController
 *
 * @package \App\Http\Controllers\Api
 */
class LanJieController extends Controller
{
    public function toParse()
    {
        $keyword = request("keyword", "");
        $header = request("header", "");
        $ip = request()->getClientIp();

        if (empty($keyword)) {
            return response()->json(["errcode" => 100, "msg" => "keyword参数不能为空", "data" => null]);
        }

        if (empty($header)) {
            return response()->json(["errcode" => 100, "msg" => "header参数不能为空", "data" => null]);
        }

        $service = new ApiService();
        $data = $service->doParse($keyword, $header, $ip);

        return response()->json(["errcode" => 0, "msg" => "", "data" => []]);
    }
}
